<?php

/*
 * This class is used for common same function.
 */

class Model_Status extends Model_Base {

    protected $_name = 'property_status';
    protected $_primaryKey = 'st_id';

    
    
    
    
    public function  fetchStatusAllData($where = "", $limit = "", $offset = "0", $order = 'st_id', $sort = 'ASC'){
        $select = $this->select()->setIntegrityCheck(false)
                ->from(array('usr' => 'property_status'));
        if ($where != '') {
            $select->where($where);
        }
        if ($limit != "") {
            $select->limit($limit, $offset);
        }
        $select->order($order . " " . $sort);
        
       # echo $select; exit;
        
        $result = parent::fetchAll($select);
        
        if (!empty($result)) {
            return $result->toArray();
        } else {
            return array();
        }
    }
    
  
    /**
     * Fetch an individual entry
     *
     * @param  int|string $id
     * @return null|Zend_Db_Table_Row_Abstract
     */
    public function fetchEntryById($id) {
        $select = $this->select()
                ->from(array('lgn' => 'property_status'))
                ->where('lgn.prp_id = ?', $id);
        // see reasoning in fetchEntries() as to why we return only an array
       # echo $select;exit;
        $data = $this->fetchRow($select);
        if (!empty($data)) {
            return $data->toArray();
        } else {
            return array();
        }
    }
   
    
     public function FetchstatusType() {
        return array(
            '' => '-- Select Type --',
            'sold' => 'Sold',
            'rented' => 'Rented'
        );
    }   

}
